package SqlTest;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.time.LocalDate;

public class TestThree {
    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            Connection connection= DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/j180?useSSL=false&serverTimezone=Asia/Shanghai","root","994152993");
            //System.out.println(connection);
//            String sql="create table t_emp(\n" +
//                     "\n" +
//                     " id int primary key auto_increment,\n" +
//                     " name varchar(20) not null,\n" +
//                     " gender char(3) default \"男\",\n" +
//                     " birthday date not null\n" +
//                     ")";
//            String sql="alter table t_emp add address varchar(500)";
//            String sql="insert into t_emp(name,gender,address,birthday) values('张三',default,'郫都区','"+LocalDate.now().toString() +"')";
            String sql="DELETE FROM t_emp WHERE id=1;";
            Statement statement=connection.createStatement();
            int num=statement.executeUpdate(sql);
            System.out.println(num);
//            while(resultSet.next()){
//
//                System.out.println(resultSet.getInt("id"));
//                System.out.println(resultSet.getString("name"));
//                System.out.println(resultSet.getString("address"));
//                System.out.println(resultSet.getString("gender"));
//                //获得日期类型的
//                System.out.println(resultSet.getDate("birthday"));
//            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
